//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//********************************************************* 

using System;
using Microsoft.Office.Core;

namespace Microsoft.TridentWordAddIn.Common
{
    /// <summary>
    /// This interface should be implemnted by components that need to 
    /// retrieve the custom XML parts in a word document.
    /// </summary>
    public interface IDocumentStorage
    {
        /// <summary>
        /// Gets or sets the package host.
        /// </summary>
        /// <value>The package host.</value>
        IThisAddInPackageHost PackageHost { get; set; }       

        /// <summary>
        /// Gets the custom XML part by id.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="id">The id.</param>
        /// <returns>CustomXMLPart</returns>
        CustomXMLPart GetCustomXmlPartById(int documentKey, string id);

        /// <summary>
        /// Gets the custom XML part by GUID.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>A Custom XML part specified by the GUID</returns>
        CustomXMLPart GetCustomXmlPartByGuid(Guid id);

        /// <summary>
        /// Deletes the custom XML part by id.
        /// </summary>
        /// <param name="id">The id of the XML part.</param>
        void DeleteCustomXmlPartById(string id);

        /// <summary>
        /// Deletes the custom XML part by GUID.
        /// </summary>
        /// <param name="id">The id.</param>
        void DeleteCustomXmlPartByGuid(Guid id);

        /// <summary>
        /// Clears the datastore and removes any trace of it form the serialization media
        /// </summary>
        void ClearCustomXmlNodes();

        /// <summary>
        /// Gets the custom XML part by GUID.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="id">The id.</param>
        /// <returns>CustomXMLPart</returns>
        CustomXMLPart GetCustomXmlPartByGuid(int documentKey, Guid id);

        /// <summary>
        /// Sets the next field.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="lsid">The lsid.</param>
        /// <param name="next">The next.</param>
        void SetNextNodeCustomXmlPart(int documentKey, string lsid, string next);

        /// <summary>
        /// Gets the next GUID.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="currentGuid">The current GUID.</param>
        /// <returns>string</returns>
        string GetNextNodeGuid(int documentKey, string currentGuid);

        /// <summary>
        /// Gets the next GUID.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="currentLsid">The current lsid.</param>
        /// <returns>string</returns>
        string GetNextNodeLsid(int documentKey, string currentLsid);

        /// <summary>
        /// Resets the specified document key.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        void Clear(int documentKey);
    }
}
